package Menu
{
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class MenuPage extends BasePage{
		private var btnPlay:SimpleButton;
		private var btnHelp:SimpleButton;
		//private var btnSettings:SimpleButton;
		//private var btnHighscores:SimpleButton;
		private var btnAuthors:SimpleButton;
		
		public function MenuPage(_vis:Sprite) {
			super(_vis);
			
			btnPlay = visual.getChildByName("btnPlay") as SimpleButton;
			btnPlay.addEventListener(MouseEvent.CLICK, btnClickHandler);
			
			btnHelp = visual.getChildByName("btnInstructions") as SimpleButton;
			btnHelp.addEventListener(MouseEvent.CLICK, btnClickHandler);
			
			//btnSettings = visual.getChildByName("btnSettings") as SimpleButton;
			//btnSettings.addEventListener(MouseEvent.CLICK, btnClickHandler);
			
			//btnHighscores = visual.getChildByName("btnHighscores") as SimpleButton;
			//btnHighscores.addEventListener(MouseEvent.CLICK, btnClickHandler);
			
			btnAuthors = visual.getChildByName("btnAuthors") as SimpleButton;
			btnAuthors.addEventListener(MouseEvent.CLICK, btnClickHandler);
		}
		
		private function btnClickHandler(e:MouseEvent):void {
			switch (e.currentTarget) {
				case btnPlay:
					dispatchEvent(new PageEvent(PageEvent.NEED_PAGE, PlayPage));
					break;
				
				case btnHelp:
					dispatchEvent(new PageEvent(PageEvent.NEED_PAGE, HelpPage));
					break;
				
				case btnAuthors:
					dispatchEvent(new PageEvent(PageEvent.NEED_PAGE, AuthorsPage));
					break;
			}
		}
		
	}
}